﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ASmile.Com
{
    public class ConfigCom
    {
        public static ConfigCom M { get; private set; }

        public static void Set(ConfigCom config, bool initCache = true)
        {
            M = config;
            if (initCache)
            {
                DataCacheCom.Init(new ORM.Cores.DBContext(config.CoreDbType, config.CoreDbConnStr));
            }
        }
        /// <summary>
        /// 核心数据库类型
        /// </summary>
        public string CoreDbType { get; set; } = "sqlserver";
        /// <summary>
        /// 核心数据库连接字符串
        /// </summary>
        public string CoreDbConnStr { get; set; }
        /// <summary>
        /// 核心数据库类型
        /// </summary>
        public string LogDbType { get; set; } = "sqlserver";
        /// <summary>
        /// 日志数据库连接字符串
        /// </summary>
        public string LogDbConnStr { get; set; }
        /// <summary>
        /// 是否保存sql日志
        /// </summary>
        public bool LogSqlSave { set; get; }
        /// <summary>
        /// 当Sql日志保存时，忽略保存日志的表名，多个,隔开
        /// </summary>
        public string LogSqlIgnoreTable { set; get; } = "Sys_Token";
        /// <summary>
        /// 是否启用缓存
        /// </summary>
        public bool EnableCache { set; get; } = true;

        ///// <summary>
        ///// 是否保存http日志
        ///// </summary>
        //public bool LogHttpSave { set; get; }
        ///// <summary>
        ///// 是否保存Http 详情，请求和响应内容
        ///// </summary>
        //public bool LogHttpSaveDetail { set; get; }

        ///// <summary>
        ///// token名称
        ///// </summary>
        //public string TokenName { set; get; }
    }
}
